function ResLock(){
  this.reqAction=new GnctXML();
  this.resLockLsh="";
  this.message="";
  this.resLockFlg="";
  this.autoEditFlg="N";
}

/**
* 释放锁
*/
ResLock.prototype.releaseEditLock=function(action){
  if(this.resLockLsh=="") return;
  this.reqAction.ExceuteAction(action);
  this.resLockLsh="";
  this.message="";
  this.resLockFlg="";
}

/**
* 申请锁
* 申请成功return true
*/
ResLock.prototype.requestEditLock=function(action){
  //alert(this.reqAction.showStr());
  if(action==""){
   return false;
  }

  var responseText=this.reqAction.ExceuteAction(action);
  if(responseText=="")
    return false;

  if(responseText.indexOf('#')!=-1)
  {
     this.resLockFlg=responseText.substring(0,responseText.indexOf('#'));

     responseText=responseText.substring(responseText.indexOf('#')+1,responseText.length);
     //找编辑锁流水号
     this.resLockLsh=responseText.substring(0,responseText.indexOf('#'));

     this.message=responseText.substring(responseText.indexOf('#')+1,responseText.length);

     if(this.resLockFlg=="00")
      return true;
     else if(this.resLockFlg=="10")
     {

       //alert(this.message);
       if(window.location.href.indexOf("?")!=-1)
         window.location.href=window.location.href+"&autoEdit=Y";
       else
         window.location.href=window.location.href+"?autoEdit=Y";

       return true
     }
     else{
      return false
     }

  }else
  {
    return false;
  }

  return false;
}

/**
* 扩展方法
*/
ResLock.prototype.extendWork=function(){
}


/**
* 执行扩展工作
*/
ResLock.prototype.executeExtendWork=function()
{
  this.extendWork();
}

